package cn.z2huo.algorithm.math.greatestCommonDivisor;

// 求两数的最大公约数
public class Test1 {
    public static void main(String[] args) {
        int num1 = 12, num2 = 30;

        if(num1 > num2){
            int temp = num1;
            num1 = num2;
            num2 = temp;
        }

        while (num2%num1!=0){
            int temp = num1;
            num1 = num2%num1;
            num2 = temp;
        }
        System.out.println("两个数的最大公约数为"+num1);

    }
}
